home *** CD-ROM | disk | FTP | other *** search
- This file contains information to allow users to add minimal support
- for the nonstandard POINTER statement provided by many FORTRAN 77
- vendors. The syntax is described below. It is not the same as the
- Fortran 90 POINTER statement. This fix does not include real checking
- of the statement other than basic syntax, but it keeps ftnchek from
- choking on it. No guarantees accompany this fix.
-
- To implement the fix, go to the directory containing the ftnchek
- source code and give the commands
- $ patch < pointer.patch
- $ make
-
- Thanks go to John Dannenhoffer for working this out. A few minor
- changes have been made to improve it. The explanations following the
- patch code are from him.
-
- The following is the patch code.
-
- diff -c ./fortran.y pointer/fortran.y
- *** ./fortran.y Tue Oct 25 17:25:19 1994
- --- pointer/fortran.y Sun Nov 6 16:45:05 1994
- ***************
- *** 224,229 ****
- --- 224,230 ----
- %token tok_OPEN
- %token tok_PARAMETER
- %token tok_PAUSE
- + %token tok_POINTER
- %token tok_PRECISION
- %token tok_PRINT
- %token tok_PROGRAM
- ***************
- *** 460,465 ****
- --- 461,467 ----
- | external_stmt
- | intrinsic_stmt
- | save_stmt
- + | pointer_stmt
- ;
-
-
- ***************
- *** 1440,1445 ****
- --- 1442,1478 ----
- {
- def_intrins_name(&($3));
- }
- + ;
- +
- + /* constructs for POINTER(pointer=pointee) statement */
- + pointer_stmt : tok_POINTER pointer_item_list EOS
- + ;
- +
- + pointer_item_list: pointer_item
- + | pointer_item_list ',' pointer_item
- + ;
- +
- + pointer_item : '(' pointer_name ',' pointee_name ')'
- + ;
- +
- + pointer_name : symbolic_name
- + {
- + declare_type(&($1),type_INTEGER,local_wordsize);
- + }
- + ;
- +
- + pointee_name : symbolic_name
- + {
- + /* Suppress set/used warnings since
- + often is accessed only via pointer */
- + use_lvalue(&($1));
- + use_variable(&($1));
- + }
- + | array_declarator
- + {
- + use_lvalue(&($1));
- + use_variable(&($1));
- + }
- ;
-
- /* 26 */
- diff -c ./keywords.h pointer/keywords.h
- *** ./keywords.h Sun Jul 10 18:56:41 1994
- --- pointer/keywords.h Sun Nov 6 16:45:05 1994
- ***************
- *** 106,111 ****
- --- 106,112 ----
- {"OPEN", tok_OPEN, IK | EK | MP | NA},
- {"PARAMETER", tok_PARAMETER, IK | NI | EK | MP | NA},
- {"PAUSE", tok_PAUSE, IK | NP | EK},
- + {"POINTER", tok_POINTER, IK | MP | NI | EK | NA},
- {"PRECISION", tok_PRECISION, IK | NI | EK | TY},
- {"PRINT", tok_PRINT, IK | EK},
- {"PROGRAM", tok_PROGRAM, IK | NP | NI | EK},
-
-
- Date: 18 Nov 1993 12:37:24 -0500
- From: dannenho@percheron.res.utc.com (John Dannenhoffer)
- To: moniot@mary.fordham.EDU
-
- Prof. Moniot,
-
- Thank you for your help in getting me started with adding the
- POINTER statement to ftnchek. With your help, I was able to
- successfully include the POINTER statement in my version of ftnchek.
- I have included the changes which I have made so that you could
- include them in a future release (if you want to).
-
- The description of the POINTER statement, taken roughly from the
- IBM Fortran manual is:
-
- Syntax:
- POINTER (pointer,pointee) [,(pointer,pointee)]
- where:
- pointer is the name of a pointer variable
- pointee is a variable name, array declarator, or array name
-
- The POINTER statement allows you to specify that the value of the
- variable 'pointer' should be used as the address for any reference
- to 'pointee'. The compiler does not allocate storage for the
- 'pointee'. The storage is allocated at execution time by the
- assignment of the address of a block of storage to the associated
- pointer. The pointer can become associated with either static or
- dynamic storage. A reference to the pointee requires that the
- associated pointer be defined.
-
- A pointer is a variable of type INTEGER*4, and you cannot
- explicitly assign a type to it. You can use pointers in any
- expression or statement in which an INTEGER*4 variable can be used.
- You can assign any data type to a pointee, but you cannot assign a
- storage class or initial value to a pointee.
-
- An actual array that appears as a pointee in a POINTER statement
- is called a pointee array. You can dimension a pointee array in
- an explicit type statement, a DIMENSION statement, or in the
- POINTER statement itself.
-
-
- Thanks again for all your help.
-
- John Dannenhoffer
- (203) 727-7775
- dannenho@utrc.utc.com
-
-